Update xend to support network configuration for qemu 0.8.1 based ioemu.
authorchris@kneesaa.uk.xensource.com <chris@kneesaa.uk.xensource.com>
Wed, 12 Jul 2006 18:16:12 +0000 (19:16 +0100)
committerchris@kneesaa.uk.xensource.com <chris@kneesaa.uk.xensource.com>
Wed, 12 Jul 2006 18:16:12 +0000 (19:16 +0100)
Remove the ne2000 option, the network device type can now be selected
on a per-device basis by adding a model= property to the device's entry
in the vif list.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
tools/examples/xmexample.hvm
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index 24ec59c66b287487d88bad9a48c274f096170497..0181a2793c9e60cd8151bc99a853f56f04dde1ba 100644 (file)
@@ -54,7 +54,7 @@ name = "ExampleHVMDomain"
 
 # Optionally define mac and/or bridge for the network interfaces.
 # Random MACs are assigned if not given.
-#vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0' ]
+#vif = [ 'type=ioemu, mac=00:16:3e:00:00:11, bridge=xenbr0, model=ne2k_pci' ]
 # type=ioemu specify the NIC is an ioemu device not netfront
 vif = [ 'type=ioemu, bridge=xenbr0' ]
 
@@ -146,10 +146,6 @@ stdvga=0
 #   then xm console or minicom can connect
 serial='pty'
 
-#----------------------------------------------------------------------------
-# enable ne2000, default = 0(use pcnet)
-ne2000=0
-
 
 #-----------------------------------------------------------------------------
 #   enable audio support
index 82f6488a8523887627aa0ab61cac97b00beba18d..11d1b81ba7547111c4946e412948a1faa33b2dac 100644 (file)
@@ -248,7 +248,7 @@ class HVMImageHandler(ImageHandler):
     # Return a list of cmd line args to the device models based on the
     # xm config file
     def parseDeviceModelArgs(self, imageConfig, deviceConfig):
-        dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'ne2000', 'audio',
+        dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'audio',
                    'localtime', 'serial', 'stdvga', 'isa', 'vcpus',
                   'usb', 'usbdevice']
         ret = []
@@ -257,11 +257,10 @@ class HVMImageHandler(ImageHandler):
 
             # python doesn't allow '-' in variable names
             if a == 'stdvga': a = 'std-vga'
-            if a == 'ne2000': a = 'nic-ne2000'
             if a == 'audio': a = 'enable-audio'
 
             # Handle booleans gracefully
-            if a in ['localtime', 'std-vga', 'isa', 'nic-ne2000', 'enable-audio', 'usb']:
+            if a in ['localtime', 'std-vga', 'isa', 'enable-audio', 'usb']:
                 if v != None: v = int(v)
                 if v: ret.append("-%s" % a)
             else:
@@ -300,24 +299,20 @@ class HVMImageHandler(ImageHandler):
                 if type != 'ioemu':
                     continue
                 nics += 1
-                if mac != None:
-                    continue
                 mac = sxp.child_value(info, 'mac')
-                bridge = sxp.child_value(info, 'bridge')
                 if mac == None:
                     mac = randomMAC()
-                if bridge == None:
-                    bridge = 'xenbr0'
-                ret.append("-macaddr")
-                ret.append("%s" % mac)
-                ret.append("-bridge")
-                ret.append("%s" % bridge)
+                bridge = sxp.child_value(info, 'bridge', 'xenbr0')
+                model = sxp.child_value(info, 'model', 'rtl8139')
+                ret.append("-net")
+                ret.append("nic,vlan=%d,macaddr=%s,model=%s" %
+                           (nics, mac, model))
+                ret.append("-net")
+                ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge))
             if name == 'vtpm':
                 instance = sxp.child_value(info, 'pref_instance')
                 ret.append("-instance")
                 ret.append("%s" % instance)
-        ret.append("-nics")
-        ret.append("%d" % nics)
         return ret
 
     def configVNC(self, config):
index b9c775e5dc84d2619157a89eab917f62e30ae0c1..865b55f595ebd6fe5e69e6822d654706e52440c9 100644 (file)
@@ -398,10 +398,6 @@ gopts.var('nographic', val='no|yes',
           fn=set_bool, default=0,
           use="Should device models use graphics?")
 
-gopts.var('ne2000', val='no|yes',
-          fn=set_bool, default=0,
-          use="Should device models use ne2000?")
-
 gopts.var('audio', val='no|yes',
           fn=set_bool, default=0,
           use="Should device models enable audio?")
@@ -605,7 +601,7 @@ def configure_vifs(config_devs, vals):
 
         def f(k):
             if k not in ['backend', 'bridge', 'ip', 'mac', 'script', 'type',
-                         'vifname', 'rate']:
+                         'vifname', 'rate', 'model']:
                 err('Invalid vif option: ' + k)
 
             config_vif.append([k, d[k]])
@@ -619,7 +615,7 @@ def configure_hvm(config_image, vals):
     """
     args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
              'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
-             'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'acpi', 'apic',
+             'vnc', 'vncviewer', 'sdl', 'display', 'acpi', 'apic',
              'xauthority', 'usb', 'usbdevice' ]
     for a in args:
         if (vals.__dict__[a]):